﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Auction_Server
{
    /// <summary>
    /// DialogWindow.xaml 的交互逻辑
    /// </summary>
    public partial class DialogWindow : Window
    {
        /// <summary>
        /// 提示框类型
        /// </summary>
        public enum MsgType 
        {
            /// <summary>
            /// 错误
            /// </summary>
            error,
            /// <summary>
            /// 警告
            /// </summary>
            information
        }

        public DialogWindow()
        {
            //
        }

        public DialogWindow(MsgType type,string title,string content)
        {
            InitializeComponent();

            //提示框图标
            switch(type){
                case MsgType.error:
                    frmIco.SetResourceReference(Image.StyleProperty, "Error");
                    break;
                case MsgType.information:
                    frmIco.SetResourceReference(Image.StyleProperty, "Information");
                    break;
                default:
                    frmIco.SetResourceReference(Image.StyleProperty, "Information");
                    break;
            }

            frmCaption.Content=this.Title = title;
            lblContent.Content = content;

        }

        /// <summary>
        /// 窗体拖动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left) this.DragMove();
        }

        /// <summary>
        /// 关闭窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCloseApp_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
